package hui.com.util;

import java.time.LocalDate;

public class DateUtil {

    /**
     * 获取当前时间的编号
     * 例如"2099-01"
     * @return 例子:"2099-01"
     */
    public static String currentYearMontID(){

        // 获取当前日期
        LocalDate currentDate = LocalDate.now();
        String month = String.format("%02d",currentDate.getMonthValue());
        String year= String.valueOf(currentDate.getYear());

        return year+"-"+month;
    }
    /**
     * 获取当前时间的编号
     * 例如"2099-01"
     * @return 例子:"2099-01"
     */
    public static String currentYearMontDayID(){

        // 获取当前日期
        LocalDate currentDate = LocalDate.now();
        String month = String.format("%02d",currentDate.getMonthValue());
        String year= String.valueOf(currentDate.getYear());
        String day= String.valueOf(currentDate.getDayOfMonth());

        return year+"-"+month+"-"+day;
    }
}
